#ifndef NETWORKVIEW_H
#define NETWORKVIEW_H

#include <QWidget>
#include <QEvent>
#include <QCloseEvent>
#include "../base/baseview.h"
#include "client/clientview.h"
#include "server/serverview.h"

namespace Ui {
class NetworkView;
}

class NetworkView : public BaseView,public Observer
{
    Q_OBJECT

public:
    explicit NetworkView(QWidget *parent = nullptr);
    virtual void init() override;
//    virtual void showView() override;
//    virtual void hideView() override;
    ~NetworkView() override;

    // 更新函数，接收来自server/client的消息，从而更新其tab
    virtual void update(QSharedPointer<Data> dataPtr);

protected:
    void closeEvent(QCloseEvent* e) override;

public slots:
    void onAddClientBtnClicked();

    void onAddServerBtnClicked();

private:
    Ui::NetworkView *ui;
};

#endif // NETWORKVIEW_H
